
package org.sopt.dev.ImgKnight.monitor.resource;

import java.io.InputStream;

import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.widgets.Display;

public class ResourceManager {

	public static Image loadImage(Display display, String imgName) {
		Image image = null;
		try {
			InputStream stream = ResourceManager.class.getResourceAsStream(imgName);
			if (stream != null) {
				ImageData imageData = new ImageData(stream);
				if (imageData != null) {
					return new Image(display, imageData);
				}
			}
		} catch (SWTException e) {
			e.printStackTrace();
		}
		return image;
	}
	
}
